<?php
class BridgeContentUrlManager {

	/**
	 * Saját típusú linkek feloldása, pl. verseny link (url:tournament kezdetű).
	 *
	 * @param array $urlComponents Url komponensek.
	 * @return string URL.
	 */
	public static function extendedEncodedUrlParsing($urlComponents) {
		$realUrl = null;
		$type = FunctionLibrary::getArrayValue($urlComponents, 0);
		if ($type == 'tournament') {
			$siteId = intval(FunctionLibrary::getArrayValue($urlComponents, 1));
			$tournamentId = FunctionLibrary::getArrayValue($urlComponents, 2);
			$langcode = FunctionLibrary::getArrayValue($urlComponents, 3);
			$forceUrl = FunctionLibrary::getArrayValue($urlComponents, 4);
			$iniParams = array('id' => $tournamentId);

			$realUrl = ContentUrlManager::getContentGeneratorUrl($siteId, 'TournamentPage', $langcode, $forceUrl);
			$realUrl = UrlUtil::addRequestParametersToUrl($realUrl, $iniParams);
		}
		return $realUrl;
	}

}